<?php
/*
 * 手机客户端 秀场展品列表接口
 * 传入参数 
 * 2013-12-011
 */
include "inc/public_header.php";
include "inc/MiniaturePro.class.php";
include "func/user.php";				//用户信息处理函数

//获取用户信息
$uInfoArr = user_getInfoFromUUID();
if(!$uInfoArr){
	echo json_encode(array("success"=>"0","errCode"=>"0"));
	die;
}
$uid = $uInfoArr["uid"]; //用户信息主键

//头像根路径
$LOGO_BASE_PATH = "http://www.chinalaohu.com/modules/miniature.php?w=150&h=150&p=/uploads/zjl_ilogo/";	


$reJson = array();//构建返回值
 
$page			= $_REQUEST["page"]; 			//页数，第一页为0
$pagesize		= $_REQUEST["pagesize"];		//每页记录数
$cid	     	= $_REQUEST["cid"];				//学校id
$panelWidth		= $_REQUEST["panelWidth"];		//屏幕宽度

if(!isset($page)){
	$page = 0;
}
if(!isset($pagesize)){
	$pagesize = 20; //默认每页10条
}

$reJson["success"] = "1";


//获取总数
$sql = "select count(distinct a.id) as ct 
from new_weituo_pingfen a inner join new_weituo_zuopin b on a.zpid=b.id 
where b.dr='0' and b.aflag='1' and a.zan='1' and b.uid='".$uid."'";
$db->query($sql);
$db->next_record();
$reJson["count"] = $db->f("ct");

//作品信息列表
$sql="
select 
		a.ilogo_path
		,a.nickname
		,a.uid
		,c.id as fensiid 
from 
		new_weituo_person a 
		left join new_weituo_fensi c on c.uid=a.uid and c.fuid='".$uid."' 
where a.uid in 
			(select distinct a.uid 
			from new_weituo_pingfen a 
		inner join new_weituo_zuopin b on a.zpid=b.id 
		where b.dr='0' 
		and b.aflag='1' 
		and a.zan='1' 
		and b.uid='".$uid."')
";
$db->query($sql);
$zan=array();
while($db->next_record){

	$zan[] = array(
		"logo"=>$LOGO_BASE_PATH.$db->f("ilogo_path")		//logo
		,"worksid"=>$db->f("nickname")		//昵称
	);
}	

$reJson["list"]=$worksArr;

echo json_encode($reJson);

?>